'use strict';

const { Controller } = require('egg');
const fs = require('fs');
const path = require('path');

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.response.type = 'html';
    ctx.body = fs.readFileSync(path.resolve(__dirname, '../../web/index.html'));
  }

  async postData() {
    const { ctx } = this;
    ctx.body = {
      data: {
        mag: 'post',
      },
    };
  }
}

module.exports = HomeController;
